<?php
namespace Orx\Etl\Extractor;
/**
 * Data Extractor Target Object Reference
 *
 * It is used to store the list of object/classname that can be
 * use to be a target data collector
 *
 * @author Xavier VILAIN
 * @package Orx\Etl\Extractor
 * @license #license-orx-etl#
 *
 * @property int	$reference	Incremental unique id
 * @property string	$objname	Object Classname
 * 
 */
class Reference extends \Fox\Object {
	
	/**
	 * Link to Items
	 * @var string
	 */
	const LINK_ITEMS = 'items';
	
	/**
	 * Retrieve All object Attribute
	 */
	public function attributes() {
		$objname = $this->objname;
		if(!empty($objname)) {
			$object = new $objname;
			foreach($object->getData() as $fieldname => $value) {
				$attributes[$fieldname] = $fieldname;
			}
			return $attributes;
		}
	}
}
\Fox\Dao::infos(Reference::className(),new \Fox\Object\Info('etl_extractor_references', \Fox\Databases::DB_APP));

// Link to fields items
\Fox\Object\Links::add(\Fox\Dao::link(Reference\Item::className(),Reference\Item::LINK_REFERENCE)
->to(Reference::className(), Reference::LINK_ITEMS)
->on('reference')
->versionFrom());